/*
 * Producer.java
 *
 * Created on Antradienis, 2006, Spalio 3, 12.14
 *
 */

package org.mif.mobp.core;
import org.mif.mobp.core.coord.*;

/**
 * Klase ims koordinates is zemesnio lygio, i sius juos i buferi
 */
public class Producer extends Thread {
    protected Buffer              buffer;
    protected RealCoordRetriever  rcr;
    protected Validator           validator;
    public boolean stop;
    /** Creates a new instance of Producer */
    public Producer(Buffer b, RealCoordRetriever r, Validator v) {
        super ();
        stop = true;
        buffer = b;
        rcr = r;
        validator = v;
    }
    
    public void run () {
        stop = false;
        while (!stop) {
            GeographicalCoordinates c = rcr.getCoordinates();
            c = validator.validate(c);
            buffer.put(c);
        }
    }
}
